<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>PyTom: Tutorial</title>
<link rel="stylesheet" type="text/css" href="./css/styles.css"></link>
</head>
<body>
<p class="Header">
	EM file type specification
</p>

<h2 id="General">A few words about EM</h2>
The EM (electron microscopy) file type is split into a header (512 bytes) and the raw data part.  
Header parameters are documented in the upper part, followed by the array storing the density information. 
PyTom uses EM as the default data type but does not really make use of fiels in the header, other than size and type relevant information.
The specification below has been copied from a TOM - Matlab function.
<br/><br/><br/>
<h2>Specification</h2>
<div class="codeFragment">
<pre>
	<code>

     -Byte 1: Machine Coding:       Machine:    Value:
                                    OS-9         0
                                    VAX          1
                                    Convex       2
                                    SGI          3
                                    Sun          4 (not supported)
                                    Mac          5
                                    PC           6
     -Byte 2: General purpose. On OS-9 system: 0 old version 1 is new version
     -Byte 3: Not used in standard EM-format, if this byte is 1 the header is abandoned. 
     -Byte 4: Data Type Coding:         Image Type:     No. of Bytes:   Value:
                                        byte            1               1
                                        short           2               2
                                        long int        4               4
                                        float           4               5
                                        float complex   8               8
                                        double          8               9
                                        double complex  16              10
     -Three long integers (3x4 bytes) are image size in x, y, z Dimension
     -80 Characters as comment
     -40 long integers (4 x 40 bytes) are user defined parameters
     -256 Byte with userdata, first 20 chars username, 8 chars date (i.e.03/02/03)
     -Raw data following with the x variable as the fastest dimension, then y and z
 
     -The parameters are coded as follwing:
        No.  |  Name  |  Value  |  Factor  |  Comment
        1       U        Volt      1          accelerating voltage
        2       COE      mm        1000       Cs of objective lense
        3       APE      mrad      1000       aperture
        4       VE       x         1          end magnification
        5       VN       1000      1000       postmagnification of CCD (fixed value:1000!)
        6       ET       s         1000       exposure time in seconds
        7       OBJ      Angstr.   1000       pixelsize in object-plane
        8       EM                 1          EM-Code:
                                                EM420=1;CM12=2;CM200=3;
                                                CM120/Biofilter=4;CM300=5;
                                                Polara=6;Krios=7;extern=0; 
        9       CCD      ???m        1000       physical pixelsize on CCD
        10      L        ???m        1000       phys_pixel_size * nr_of_pixels
        11      DF       Angstr.   1          defocus, underfocus is neg.
        12      FA       Angstr.   1          astigmatism
        13      PHI      deg       1000       angle of astigmatism 
        14      DDF      Angstr.   1          focusincr. for focus-series
        15      CTS      -         1000       counts per primary electron, sensitivity of CCD
        16      C2       -         1000       intensity value of C2
        17      EW       eV        1          0 for no slit, x>0 for positive slitwidth 
        18      EO       eV        1          energy offset from zero-loss
        19      KW       deg       1000       tiltangle 
        20      KR       deg       1000       tiltaxis
        21      -        Angstr.   1           
        22      SC       ASCII     1
        23      -        -         -
        24      -        pixel     1          markerposition X
        25      -        pixel     1          markerposition Y
        26      -        Angstr.   1000       internal: resolution
        27      -        -         -          internal: density
        28      -        -         -          internal: contrast
        29      -        -         -          internal: unknown
        30      SP       -         1000       mass centre X
        31      SP       -         1000       mass centre Y
        32      SP       -         1000       mass centre Z
        33      H        -         1000       height
        34      -        -         1000       internal: unknown
        35      D1       -         1000       width 'Dreistrahlbereich'
        36      D2       -         1000       width 'Achrom. Ring'
        37      -        -         1          internal: lambda
        38      -        -         1          internal: delta theta
        39      -        -         1          internal: unknown
        40      -        -         1          internal: unknown

	</code>
</pre>
</div>